package cn.xlbweb.sso.config;

import cn.xlbweb.sso.interceptor.LoginInterceptor;
import cn.xlbweb.sso.interceptor.TimeInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author: bobi
 * @date: 2019-03-24 21:47
 * @description:
 */
@Component
public class WebMvcConfig implements WebMvcConfigurer {

    @Autowired
    private PropertiesConfig propertiesConfig;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new TimeInterceptor());
        registry.addInterceptor(new LoginInterceptor()).excludePathPatterns(propertiesConfig.getExcludeUris());
    }
}
